/**
 * Copyright (c) 2008 michiyasu wada
 * http://www.seyself.com/
 * 
 * Distributed under The MIT License.
 * [http://www.opensource.org/licenses/mit-license.php]
 */

package demo.objects 
{
import com.seyself.utils.BitmapUtil;
import flash.display.Sprite;
import flash.events.Event;
import jp.progression.casts.CastSprite;
import jp.progression.commands.DoTweener;
import jp.progression.commands.Func;


public class HeaderCast extends CastSprite
{
    
    public function get search():SearchBox
    {
        return SearchBox(getChildByName("searchBox"));
    }
    
    public function HeaderCast() 
    {
        
    }
    
    override protected function _onCastAdded():void
    {
        var dummy:Sprite = BitmapUtil.dummy( this );
        visible = false;
        dummy.alpha = 0.0;
        
        addCommand(
            new DoTweener( dummy, { alpha: 1.0, time: 0.8 }, 200 ),
            new Func( this, function() { dummy.parent.removeChild(dummy); this.visible = true; } )
        );
    }
    
    override protected function _onCastRemoved():void
    {
        addCommand(
            new DoTweener( this, { alpha: 0.0, time: 0.3 } )
        );
    }
    
}

}